clear all

% data in the cell array always comes modified and arranged for the labels
% alignement;
% DON'T FORGET TO CHANGE THE NAME IN LINES 8,11, 12, 46

%% call the values of speed, x and y
speedall = xlsread ('RRF3_exp30_ZC2834_speed_all_F1');%all the individuals to make the scale

%% extract the values of x and y
load ('C:\Users\Ana\Dropbox\Matlab\data\matlab data\RRF3_exp30_ZC2834_F1\RRF3_exp30_ZC2834_PA choice PA\RRF3_exp30_ZC2834_PA_to_PA_F1.mat');
data = RRF3_exp30_ZC2834_PA_to_PA_F1;

%speedall = xlsread ('veltodos 9');%all the individuals to make the scale
speedrange = velocidadef (speedall);
speedminall = speedrange (1,1);
speedmaxall = speedrange (1,2);

sujeitos = size (data,1)-1;% because it is counting with the label row
sujeitosloop = sujeitos + 1;

for i=2:sujeitosloop;
    speed = data (i,5);
    speedvalues = speed {1,1};
    speedNorm = (speedvalues - speedminall) / ( speedmaxall - speedminall) ;
    
    xpos = data (i, 17);
    xposvalues = xpos {1,1};
    
    ypos = data (i, 18);
    yposvalues = ypos {1,1};
    
    center = [7500, 12500];
    radius = (2000);          
figure
%subplot (2,3, i);
viscircles (center, radius, 'Color', 'k');
hold on
% our plot with the coordinates x and y, size of dots 10 and color based on
% our heat map
scatter(xposvalues,yposvalues,10,speedNorm, 'filled')%the color of my graph depends on the vector speednorm
colormap('jet')
box off
axis ([0,25000, 0, 25000]);
axis square
s1 = 'PA to PA Worm';
s2 = data (i, 1);
s2val = s2{1,1};
s3 = num2str(s2val);
name = strcat(s1,s3);
title(name)
xlabel ('x')
ylabel ('y')
%%  make the scale
speed0 = speedNorm (1,1); %find the value of 0 when normalized; 1st colum 1st row 
%because in the speed values the first values are always speed = 0
c = colorbar;
c.Label.String = 'Speed (um/s)';
caxis([0 1.0])% our speed is normalized from 0 to 1 so will match the scale
colorbar('Ticks',[0,speed0,1.0],...
         'TickLabels',{speedminall,0,speedmaxall});


hold on;
end


